/*
    XTU OJ: 1324
    by: fifth_light
*/

#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>

int col[200];
int col_size;
int act_size;
char cnts[100050];

int is_clash(int num) {
    char hashs[100050] = {0};
    for (int i = 0; i < act_size; i++) {
        int hash = col[i] % num;
        if (hashs[hash] == 0) {
            hashs[hash] = 1;
        } else {
            return 0;
        }
    }
    return 1;
}

int main(void) {
    int t;
    scanf("%d", &t);
    for(int i = 0; i < t; i++) {
        scanf("%d", &col_size);
        act_size = 0;
        memset(cnts, 0, sizeof(cnts));
        for (int j = 0; j < col_size; j++) {
            int num;
            scanf("%d", &num);
            if (cnts[num] == 0) {
                col[act_size++] = num;
                cnts[num] = 1;
            }
        }
        int res = 2;
        while (!is_clash(res)) {
            res++;
        }
        printf("%d\n", res);
    }
    return 0;
}
